3 ; This script is based on example1.nsi, but it remember the directory,
4 ; has uninstall support and (optionally) installs start menu shortcuts.
6 ; It will install example2.nsi into a directory that the user selects,
8 ;--------------------------------
12 !define FULL_VERSION
"1.0.0.0"
15 !define SOURCE_DIR
"C:\source\temp\InstallerTest\runner"
17 !ifndef INSTALLER_FILENAME
18 !define INSTALLER_FILENAME
"C:\source\temp\InstallerTest\RunnerInstaller.exe"
22 !define MAKENSIS
"%appdata%\GameMaker-Studio\makensis"
26 !define COMPANY_NAME
""
30 !define COPYRIGHT_TXT
"(c)Copyright 2013"
34 !define FILE_DESC
"Created with GameMaker:Studio"
38 !define LICENSE_NAME
"License.txt"
42 !define ICON_FILE
"icon.ico"
45 !ifndef IMAGE_FINISHED
46 !define IMAGE_FINISHED
"Runner_finish.bmp"
50 !define IMAGE_HEADER
"Runner_header.bmp"
54 !define PRODUCT_NAME
"Runner"
57 !define APP_NAME
"${PRODUCT_NAME}"
58 !define SHORT_NAME
"${PRODUCT_NAME}"
61 !define EXE_NAME
"${PRODUCT_NAME}"
66 !define MIN_FRA_MAJOR
"2"
67 !define MIN_FRA_MINOR
"0"
68 !define MIN_FRA_BUILD
"*"
72 ;--------------------------------
74 ; The name of the installer
77 BrandingText "${APP_NAME}"
80 OutFile "${INSTALLER_FILENAME}"
82 ; The default installation directory
83 InstallDir "$PROFILE\${APP_NAME}"
85 ; Registry key to check for directory (so if you install again, it will
86 ; overwrite the old one automatically)
87 InstallDirRegKey HKCU "Software\Runner" "Install_Dir"
89 ; Request application privileges for Windows Vista
90 RequestExecutionLevel admin
93 VIProductVersion
"${FULL_VERSION}"
94 VIAddVersionKey
/LANG=
1033 "FileVersion" "${FULL_VERSION}"
95 VIAddVersionKey
/LANG=
1033 "ProductVersion" "${FULL_VERSION}"
96 VIAddVersionKey
/LANG=
1033 "ProductName" "${PRODUCT_NAME}"
97 VIAddVersionKey
/LANG=
1033 "CompanyName" "${PRODUCT_PUBLISHER}"
98 VIAddVersionKey
/LANG=
1033 "LegalCopyright" "${COPYRIGHT_TXT}"
99 VIAddVersionKey
/LANG=
1033 "FileDescription" "${FILE_DESC}"
103 !define MUI_HEADERIMAGE
104 !define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
105 !define MUI_ICON
"${ICON_FILE}"
106 !define MUI_WELCOMEFINISHPAGE_BITMAP
"${IMAGE_FINISHED}"
107 !define MUI_HEADERIMAGE_BITMAP
"${IMAGE_HEADER}"
108 !define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
111 ;--------------------------------
114 !insertmacro MUI_PAGE_LICENSE
"${LICENSE_NAME}"
115 !insertmacro MUI_PAGE_COMPONENTS
116 !insertmacro MUI_PAGE_DIRECTORY
117 !insertmacro MUI_PAGE_INSTFILES
118 # These indented statements modify settings for MUI_PAGE_FINISH
119 !define MUI_FINISHPAGE_NOAUTOCLOSE
120 !define MUI_FINISHPAGE_RUN_TEXT
"Start ${PRODUCT_NAME}"
121 !define MUI_FINISHPAGE_RUN
"$INSTDIR\${EXE_NAME}.exe"
122 !insertmacro MUI_PAGE_FINISH
124 Var DirectXSetupError
126 UninstPage uninstConfirm
129 !insertmacro MUI_LANGUAGE
"English"
130 ;--------------------------------
132 ; The stuff to install
133 Section `${APP_NAME}`
136 ; Set output path to the installation directory.
140 File "${LICENSE_NAME}"
141 File /r
"${SOURCE_DIR}\*.*"
143 ; Write the uninstall keys for Windows
144 WriteRegStr SHCTX
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORT_NAME}" "DisplayName" "${APP_NAME}"
145 WriteRegStr SHCTX
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORT_NAME}" "UninstallString" '"$INSTDIR\uninstall.exe"'
146 WriteRegDWORD SHCTX
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORT_NAME}" "NoModify" 1
147 WriteRegDWORD SHCTX
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORT_NAME}" "NoRepair" 1
148 WriteUninstaller "uninstall.exe"
152 ; Optional section (can be disabled by the user)
153 Section "Start Menu Shortcuts"
155 CreateDirectory "$SMPROGRAMS\${APP_NAME}"
156 CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
157 CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${EXE_NAME}.exe" "" "$INSTDIR\${EXE_NAME}.exe"
158 CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} License.lnk" "notepad.exe" "$INSTDIR\License.txt"
163 ; Optional section (can be enabled by the user)
164 Section /o
"Desktop shortcut"
166 CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${EXE_NAME}.exe" ""
171 ;--------------------------------
176 ; Remove registry keys
177 DeleteRegKey SHCTX
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORT_NAME}"
179 ; Remove files and uninstaller (everything)
182 ; Remove desktop icon
183 Delete "$DESKTOP\${APP_NAME}.lnk"
185 ; Remove shortcuts, if any
186 Delete "$SMPROGRAMS\${APP_NAME}\*.*"
188 ; Remove directories used
189 RMDir "$SMPROGRAMS\${APP_NAME}"
195 ;--------------------------------
197 ; This should be the LAST section available....
199 Section "DirectX Install" SEC_DIRECTX
204 File "${MAKENSIS}\dxwebsetup.exe"
205 DetailPrint "Running DirectX Setup..."
206 ExecWait '"$TEMP\dxwebsetup.exe" /Q' $DirectXSetupError
207 DetailPrint "Finished DirectX Setup"
209 Delete "$TEMP\dxwebsetup.exe"
211 SetOutPath "$INSTDIR"